<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
                             "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:rich="http://richfaces.org/rich" 
	template="layout/template.xhtml">

	<ui:define name="body">
	<h:messages globalOnly="true" styleClass="message" id="globalMessages"/>
	
	<h:form id="cabineSearch" styleClass="edit">
	
		<h:panelGrid columns="3">
				<h:outputText value="consultar" styleClass="tituloPagina" />
				|
				<h:commandLink  value="Nova Cabine" action="/cabine.xhtml" />
			</h:panelGrid><br/>
			<rich:panel>
				<h:panelGrid columns="3" width="800">
				<h:column>
					<h:outputLabel value="Numero" /><br/>			
					<h:inputText value="#{cabineList.cabine.numero}" />
				</h:column>
				<h:column>
					<h:outputLabel value="Classe" for="tipoClasse" /><br/>
					<h:selectOneMenu value="#{cabineList.cabine.tipoClasse}">
						<s:selectItems var="classe" label="#{classe.descricao}"
							value="#{classes}">
							</s:selectItems>
						<s:convertEnum></s:convertEnum>
					</h:selectOneMenu>
				</h:column>
				
				<h:column>
					<h:outputLabel value="Navio" for="navio" /><br/>
					<h:selectOneMenu value="#{cabineList.navio}">
						<s:selectItems noSelectionLabel="Selecione.." value="#{navioList.resultList}" var="navio_" label="#{navio_.nome}">
							</s:selectItems>
						<s:convertEntity />
					</h:selectOneMenu>
				</h:column>
				</h:panelGrid>
			</rich:panel>
			<rich:spacer height="5px" />
			<h:panelGrid columns="3">
				<h:commandButton value="Consultar" id="consultar" action="#{cabineList.pesquisar()}" />
				|
				<h:commandLink  value="Limpar" />
			</h:panelGrid><br/>
			
			<rich:dataTable id="cabineList" var="cabine"
				value="#{cabineList.cabines}" rows="10"
				rendered="#{not empty cabineList.cabines}">
				<rich:column>
					<f:facet name="header">Numero</f:facet>
					<s:link id="numero" value="#{cabine.numero}" view="/cabine.xhtml">
						<f:param name="cabineId" value="#{cabine.id}" />
					</s:link>
				</rich:column>
				<rich:column>
					<f:facet name="header">Tipo</f:facet> 
					<s:link id="classe" value=" #{cabine.tipoClasse.descricao}" view="/cabine.xhtml">
						<f:param name="cabineId" value="#{cabine.id}" />
					</s:link>
                                    
                </rich:column>
				<rich:column>
					<f:facet name="header">Navio</f:facet>
					#{cabine.navio.numero} - #{cabine.navio.nome}
				</rich:column>
			</rich:dataTable>
      		<rich:datascroller for="cabineList" maxPages="5" renderIfSinglePage="false" 
					rendered="#{not empty cabineList.cabines}" />
			
	</h:form>
	
	</ui:define>

</ui:composition>

